import Vue from 'vue'
import VueRouter from 'vue-router'
const Layout        = r => require.ensure([], () => r(require('@/projects/blog/pages/Layout')), 'Layout')
const Home          = r => require.ensure([], () => r(require('@/projects/blog/pages/Home')), 'Home')
const Project       = r => require.ensure([], () => r(require('@/projects/blog/pages/Project')), 'Project')

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'Layout',
        component: Layout,
        redirect: "/home",
        children: [
            {   // 首页
                path: "/home",
                name: "Home",
                component: Home, 
            },
            {   // 项目
                path: "/project",
                name: "Project",
                component: Project, 
            },
        ]
    },
]

const router = new VueRouter({
    // mode: 'history',
    routes
})

export default router
